using HKB.Common;
using System;
using System.Data;
using System.Web;
namespace HKB.Web
{
	public class SysLabel
	{
		private Conn conn = null;
		private DataRow config = new Config().config;
		private SkinBll _myskin = null;
		private TemProjectBll _mytempro = null;
		private SkinBll myskin
		{
			get
			{
				SkinBll myskin;
				if (this._myskin == null)
				{
					this._myskin = new SkinBll(this.conn);
					myskin = this._myskin;
				}
				else
				{
					myskin = this._myskin;
				}
				return myskin;
			}
		}
		private TemProjectBll mytempro
		{
			get
			{
				TemProjectBll mytempro;
				if (this._mytempro == null)
				{
					this._mytempro = new TemProjectBll(this.conn);
					mytempro = this._mytempro;
				}
				else
				{
					mytempro = this._mytempro;
				}
				return mytempro;
			}
		}
		public SysLabel(Conn _conn)
		{
			this.conn = _conn;
		}
		public string ShowSiteName()
		{
			return this.config["SiteName"].ToString();
		}
		public string ShowCopyRight()
		{
			return this.config["CopyRight"].ToString();
		}
		public string ShowLogo()
		{
			return "<img  src=\"" + this.config["InstallDir"].ToString() + this.config["LogoUrl"].ToString() + "\" ID=\"Logo\" border=\"0\" />";
		}
		public string ShowPageTitle()
		{
			return "威购商城";
		}
		public string ShowInstallDir()
		{
			return this.config["InstallDir"].ToString();
		}
		public string ShowSiteUrl()
		{
			return this.config["SiteUrl"].ToString();
		}
		public string ShowBanner()
		{
			return "<img src=\"" + this.config["BannerUrl"].ToString() + "\" ID=\"Banner\" border=\"0\" />";
		}
		public string ShowWebMaster()
		{
			return this.config["WebMasterName"].ToString();
		}
		public string ShowWebMasterEmail()
		{
			return this.config["WebMasterEmail"].ToString();
		}
		public string GetCopyRight()
		{
			return this.config["CopyRight"].ToString();
		}
		public string GetTemplateDir()
		{
			return this.config["TemplateDir"].ToString();
		}
		public string GetMetaKeyword()
		{
			return this.config["MetaKeywords"].ToString();
		}
		public string GetMetaDescription()
		{
			return this.config["MetaDescription"].ToString();
		}
		public string GetOtherTitle()
		{
			return this.config["otherTitle"].ToString();
		}
		public string ProjectSkinDir()
		{
			DataTable defaultProject = this.mytempro.GetDefaultProject();
			return defaultProject.Rows[0]["SkinDir"].ToString();
		}
		public string ShowLogingName()
		{
			string result;
			if (Fetch.GetCookies("Howave_UserName") != null && Fetch.GetCookies("Howave_UserPassword") != null && Fetch.GetCookies("Howave_UserID") != string.Empty)
			{
				result = HttpContext.Current.Server.UrlDecode(Fetch.GetCookies("Howave_UserName"));
			}
			else
			{
				result = string.Empty;
			}
			return result;
		}
		public string ShowUserCookie()
		{
			string result;
			if (!string.IsNullOrEmpty(Fetch.GetCookies("Howave_UserName")))
			{
				result = HttpContext.Current.Server.UrlDecode(Fetch.GetCookies("Howave_UserName"));
			}
			else
			{
				result = null;
			}
			return result;
		}
		public string ShowLogingUserID()
		{
			string result;
			if (Fetch.GetCookies("Howave_UserID") != string.Empty)
			{
				result = Fetch.GetCookies("Howave_UserID");
			}
			else
			{
				result = "0";
			}
			return result;
		}
		public string GetDefaultIndexCss(string SkinType)
		{
			DataTable proDefaultBySkinType = this.myskin.GetProDefaultBySkinType(SkinType);
			string result;
			if (proDefaultBySkinType.Rows.Count >= 1)
			{
				if (proDefaultBySkinType.Rows[0]["SkinPath"] != null)
				{
					result = string.Concat(new string[]
					{
						"<link type=\"text/css\" rel=\"stylesheet\" href=\"",
						this.config["InstallDir"].ToString(),
						"Skin/",
						this.ProjectSkinDir(),
						proDefaultBySkinType.Rows[0]["SkinPath"].ToString(),
						"\" />"
					});
				}
				else
				{
					result = "";
				}
			}
			else
			{
				result = "";
			}
			return result;
		}
	}
}
